/*
 * Copyright (c) 2024. hallele, Inc All rights reserved.
 */

package cn.hallele.mc.sdk.usercenter.dto;

import cn.hallele.mc.sdk.usercenter.common.enums.DeptStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * hallele_ms_usercenter
 *
 * @author anle5
 * @since 2024/11/12 22:45
 */
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "部门传输对象")
public class DeptDTO implements Serializable {
    @Serial
    private static final long serialVersionUID = -3603931337462280718L;

    /**
     * 主键
     */
    @Schema(description = "主键")
    private Integer id;

    /**
     * 部门编号
     */
    @Schema(description = "部门编号")
    private Integer number;

    /**
     * 部门名字
     */
    @Schema(description = "部门名字")
    private String name;

    /**
     * 部门描述
     */
    @Schema(description = "部门描述")
    private String description;

    /**
     * 部门负责人
     */
    @Schema(description = "部门负责人")
    private Leader leader;

    /**
     * 部门电话
     */
    @Schema(description = "部门电话")
    private String phone;

    /**
     * 部门邮件
     */
    @Schema(description = "部门邮件")
    private String email;

    /**
     * 状态(0:启用;1:禁用)
     */
    @Schema(description = "状态(0:启用;1:禁用)")
    private DeptStatusEnum status;

    /**
     * 排序，越低越靠前
     */
    @Schema(description = "排序，越低越靠前")
    private Integer sorted;

    /**
     * 父部门
     */
    @Schema(description = "父部门")
    private Integer parentId;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private Date createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    private Date updateTime;

    /**
     * 创建人id
     */
    @Schema(description = "创建人id")
    private Long createBy;

    /**
     * 修改人id
     */
    @Schema(description = "修改人id")
    private Long updateBy;

    /**
     * 子部门
     */
    @Schema(description = "子部门")
    private List<DeptDTO> children = new ArrayList<>();

    /**
     * 部门负责人
     */
    @Setter
    @Getter
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "部门负责人")
    public static class Leader implements Serializable {
        @Serial
        private static final long serialVersionUID = -4531848163963169225L;

        /**
         * 部门责任人id
         */
        @Schema(description = "部门责任人id")
        private Long id;

        /**
         * 部门责任人名字
         */
        @Schema(description = "部门责任人名字")
        private String username;
    }
}
